<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::any('login','LoginController@index')->name('login');
Route::get('logout', 'LoginController@logout');
Route::middleware(['auth'])->group(function (){
    Route::get('/', function () {
        return redirect('dashboard');
    });
    Route::get('dashboard', 'DashboardController@index');
    Route::any('profile', 'ProfileController@index'); //个人设置
});
Route::middleware(['auth','myPermission'])->group(function (){
    Route::any('user', 'UserController@index');
    Route::any('user/add', 'UserController@add');
    Route::any('user/setIsDel', 'UserController@setIsDel')->name('setUserIsDel');
    Route::any('user/edit/{id}', 'UserController@edit')->name('editUser'); //编辑用户
    Route::get('user/permission', 'UserController@permission');
    Route::post('user/addPermission', 'UserController@addPermission')->name('addPermission'); //添加行为
    Route::get('user/role', 'UserController@role'); //角色列表
    Route::post('user/addRole', 'UserController@addRole')->name('addRole'); //添加角色
    Route::any('user/editRole/{id}', 'UserController@editRole')->name('editRole'); //分配权限
    Route::post('user/getAllPermission', 'UserController@getAllPermission');//获取所有行为
    Route::post('user/getAllRole', 'UserController@getAllRole');//获取所有角色
});